home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 6 / coreaids.zip / WRITE.ASM < prev   
Assembly Source File  |  1987-06-25  |  995b  |  44 lines

  1. ;    DESC;    Writes to a data file                                V1.00
  2. ;    IN:    *{HANDLE} handle of file
  3. ;        *{NUM_BYTES} number of bytes to write
  4. ;        *{SEG_VAL} segment and
  5. ;        *{OFFSET} offset of buffer
  6. ;    OUT:    *{OUT_BYTES} number of bytes actually written
  7. ;    SAMPLE:    Callm    WRITE,<HANDLE,NUM_BYTES,SEG_VAL,OFFSET>,<OUT_BYTES>
  8. ;    ################################################################### 
  9.  
  10.     Extrn    PUSHALL:Near
  11.     Extrn    POPALL:Near
  12.     Extrn    ERRORMSG:Near
  13.  
  14. WRITEC    Segment
  15.     Assume    CS:WRITEC
  16.     Public    WRITE
  17.  
  18.                         ;notice.
  19.     DB    'WRITE    - V1.00, Copyright 1987, CoreTechs   ',0DH,0AH
  20.  
  21. WRITE    Proc    Near                ;writes a file.
  22.  
  23.     Call    PUSHALL
  24.  
  25.     Pop    DX                ;get buffer offset.
  26.     Pop    DS                ;get buffer segment.
  27.     Pop    CX                ;get number of bytes to write.
  28.     Pop    BX                ;get the handle.
  29.  
  30.     Mov    AH,40H                ;write a file.
  31.     Int    21H
  32.     Jc    ERROR                ;if an error report it.
  33.  
  34.     Push    AX
  35.     Call    POPALL
  36.     Ret
  37.  
  38. ERROR:    Push    AX                ;report error and abort.
  39.     Call    ERRORMSG
  40.  
  41. WRITE    Endp
  42. WRITEC    Ends
  43.     End
  44.